package com.vg.Adapter;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import android.app.Activity;
import android.app.ListActivity;
import android.content.ClipData.Item;
import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.SlideMenu.chatlove.R;
import com.vg.FrameUI.yahoo_frame;
import com.vg.classSample.Friend;
import com.vg.classSample.yahoo;

public class adapter_yahoo extends BaseAdapter {

	private ImageView icon;
	private Button bt_name;
	private TextView tv_status;
	
	private Context mContext;

	//private ArrayList<HashMap<String, String>> data=new ArrayList<HashMap<String,String>>();
	private static LayoutInflater inflater = null;

	// Friend m_Friend=new Friend(status, name, url_img)

	private ArrayList<yahoo> mItems=new ArrayList<yahoo>();
		 
		public adapter_yahoo(Context context, ArrayList<yahoo> items) {
		     this.mContext = context;
		     this.mItems = items;
		     inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return mItems.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
	
		if (convertView == null) {
			convertView = inflater.inflate(R.layout.item_yahoo, null);
		}
		yahoo_frame post=(yahoo_frame)convertView.findViewById(R.id.frame_yh);
		post.fillData(mItems.get(position).getName(),mItems.get(position).getUrl_img(), mItems.get(position).getStatus());

	//	bt_name = (Button) vi.findViewById(R.id.contact_tv_name_1);
	//	tv_status = (TextView) vi
		//		.findViewById(R.id.contact_tv_status_1);
		
	//	 icon = (ImageView) vi.findViewById(R.id.contact_img_user_1);
//		 if(mItems.get(position).getImage() != null)
//		 {
//			icon.setImageBitmap(mItems.get(position).getImage());
//		 }
//		 else
//		 {
//			 icon.setImageResource(R.drawable.ic_launcher);
//			 //getItem(position).
//			//icon.setImageBitmap(mItems.get(position).getImage());
////			/ mItems.get(position).loadImage(mItems.get(position).getUrl_img());
//		 }
//		 bt_name.setText(mItems.get(position).getName());
//		 tv_status.setText(mItems.get(position).getStatus());
//		 String tv=tv_status.getText().toString();
//		 String bt=bt_name.getText().toString();
//		 Log.i("adapter1", tv);
//		 Log.i("adapter2", bt);
		return convertView;

	}

	

}
